package bme.andraskindler.treenventory.model;

import java.io.Serializable;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection = "trees")
public class TreeData implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	private long id;
	private String type;
	private Double longitude;
	private Double latitude;
	private Double width;
	private long date;

	public TreeData() {
	}

	public String toXML() {
		String result = "\t<treedata>\n";

		result += "\t<id>" + id + "</id>\n";
		result += "\t\t<type>" + type + "</type>\n";
		result += "\t\t<longitude>" + longitude + "</longitude>\n";
		result += "\t\t<latitude>" + latitude + "</latitude>\n";
		result += "\t\t<width>" + width + "</width>\n";
		result += "\t\t<date>" + date + "</date>\n";

		return result + "\t</treedata>\n";
	}

	public static String getCSVAttributes() {
		return "id,type,longitude,latitude,width,date\n";
	}

	public String toCSV() {
		return id + ",\"" + type + "\"," + longitude + "," + latitude + "," + width + "," + date+"\n";
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Double getLongitude() {
		return longitude;
	}

	public void setLongitude(Double longitude) {
		this.longitude = longitude;
	}

	public Double getLatitude() {
		return latitude;
	}

	public void setLatitude(Double latitude) {
		this.latitude = latitude;
	}

	public Double getWidth() {
		return width;
	}

	public void setWidth(Double width) {
		this.width = width;
	}

	public long getDate() {
		return date;
	}

	public void setDate(long date) {
		this.date = date;
	}

}
